home *** CD-ROM | disk | FTP | other *** search
/ Visual Basic Source Code / Visual Basic Source Code.iso / vbsource / bmp_db / bmp_db.frm < prev    next >
Text File  |  1995-05-08  |  5KB  |  164 lines

  1. VERSION 2.00
  2. Begin Form BMP_DB 
  3.    BorderStyle     =   3  'Fixed Double
  4.    Caption         =   "Bitmap DataBase Demo"
  5.    ClientHeight    =   2055
  6.    ClientLeft      =   2550
  7.    ClientTop       =   2220
  8.    ClientWidth     =   3495
  9.    Height          =   2460
  10.    Icon            =   BMP_DB.FRX:0000
  11.    Left            =   2490
  12.    LinkTopic       =   "Form1"
  13.    MaxButton       =   0   'False
  14.    ScaleHeight     =   2055
  15.    ScaleWidth      =   3495
  16.    Top             =   1875
  17.    Width           =   3615
  18.    Begin PictureBox Picture1 
  19.       Height          =   975
  20.       Left            =   240
  21.       ScaleHeight     =   945
  22.       ScaleWidth      =   1065
  23.       TabIndex        =   6
  24.       Top             =   2160
  25.       Width           =   1095
  26.    End
  27.    Begin CommandButton Exit 
  28.       Cancel          =   -1  'True
  29.       Caption         =   "Exit"
  30.       Height          =   375
  31.       Left            =   1920
  32.       TabIndex        =   4
  33.       Top             =   1560
  34.       Width           =   1455
  35.    End
  36.    Begin CommandButton Load_DB 
  37.       Caption         =   "Load DB"
  38.       Height          =   375
  39.       Left            =   1920
  40.       TabIndex        =   5
  41.       Top             =   120
  42.       Width           =   1455
  43.    End
  44.    Begin CommandButton Add_Pic 
  45.       Caption         =   "Add..."
  46.       Default         =   -1  'True
  47.       Enabled         =   0   'False
  48.       Height          =   375
  49.       Left            =   1920
  50.       TabIndex        =   3
  51.       Top             =   840
  52.       Width           =   1455
  53.    End
  54.    Begin VScrollBar VScroll1 
  55.       Enabled         =   0   'False
  56.       Height          =   1815
  57.       Left            =   1560
  58.       Min             =   1
  59.       TabIndex        =   0
  60.       Top             =   120
  61.       Value           =   1
  62.       Width           =   255
  63.    End
  64.    Begin CommonDialog CMDialog1 
  65.       Left            =   2400
  66.       Top             =   1320
  67.    End
  68.    Begin Shape Shape1 
  69.       Height          =   1335
  70.       Left            =   120
  71.       Top             =   120
  72.       Width           =   1455
  73.    End
  74.    Begin Label Recnum 
  75.       BorderStyle     =   1  'Fixed Single
  76.       Caption         =   "Record# x of y"
  77.       Height          =   255
  78.       Left            =   120
  79.       TabIndex        =   2
  80.       Top             =   1680
  81.       Width           =   1455
  82.    End
  83.    Begin Label Pic_Caption 
  84.       BorderStyle     =   1  'Fixed Single
  85.       Caption         =   "Caption"
  86.       Height          =   255
  87.       Left            =   120
  88.       TabIndex        =   1
  89.       Top             =   1440
  90.       Width           =   1455
  91.    End
  92.    Begin Image Image1 
  93.       Height          =   1335
  94.       Left            =   120
  95.       Stretch         =   -1  'True
  96.       Top             =   120
  97.       Width           =   1455
  98.    End
  99. End
  100. ' Declare Form Variables:
  101. Dim Data_file As String ' Declare File Name Variable
  102. Dim Num_of_Entries As Integer ' Number of Records in File.
  103.  
  104. Sub Add_Pic_Click ()
  105. ' Set Dialog Options for Add File
  106. CMDialog1.DialogTitle = "Add File"
  107. CMDialog1.Filter = "All Files (*.*)|*.*|Graphic Files|*.BMP; *.RLE; *.DIB; *.WMF|Bitmaps (*.BMP)|*.BMP|Run-Length Encoding (*.RLE)|*.RLE|DIB (*.DIB)|*.DIB)|Windows Metafile (*.WMF)|*.WMF"
  108. CMDialog1.FilterIndex = 2
  109. CMDialog1.Filename = ""
  110. CMDialog1.Action = 1
  111. ' Check for Cancel
  112. If CMDialog1.Filename = "" Then Exit Sub
  113. ' Call PiCDB_Add File Routine
  114. P$ = CMDialog1.Filename
  115. PicDB_Add Data_file, P$, InputBox$("Enter Picture Title:", "Picture Title"), Picture1
  116. Num_of_Entries = Num_of_Entries + 1
  117. Recnum.Caption = "Record" + Str$(Vscroll1.Value) + " of" + Str$(Num_of_Entries)
  118. Vscroll1.Enabled = True
  119. Vscroll1.Max = Num_of_Entries
  120. 'Update Scroll Bar
  121. VScroll1_Change
  122. End Sub
  123.  
  124. Sub Exit_Click ()
  125. ' Exit Program
  126. End
  127. End Sub
  128.  
  129. Sub Load_DB_Click ()
  130. ' Set Options for Open Dialogbox.
  131. CMDialog1.DialogTitle = "Load DataBase"
  132. CMDialog1.Filename = ""
  133. CMDialog1.Filter = "All Files (*.*)|*.*|Data Files (*.DAT)|*.DAT"
  134. CMDialog1.FilterIndex = 2
  135. ' Show Dialog
  136. CMDialog1.Action = 1
  137. ' Check for Cancel
  138. If CMDialog1.Filename = "" Then Exit Sub
  139. ' Enable File
  140. Data_file = CMDialog1.Filename
  141. Add_Pic.Enabled = True
  142. ' Check for Records
  143. Open Data_file For Binary As #1
  144. If LOF(1) = 0 Then Vscroll1.Enabled = False: Close #1: Exit Sub' If no data, disable Scroll Controll, Close File, and exit this sub
  145. Get #1, 1, Num_of_Entries
  146. 'After gettin # of entries, display data in Label and Scroll Bar.
  147. Recnum.Caption = "Record 1 of" + Str$(Num_of_Entries)
  148. Vscroll1.Max = Num_of_Entries
  149. Close #1
  150. Vscroll1.Enabled = True
  151. 'Update Scroll Box
  152. VScroll1_Change
  153. End Sub
  154.  
  155. Sub VScroll1_Change ()
  156. 'Load Picture and Caption
  157. L% = Vscroll1.Value
  158. PICDB_Load Data_file, L%, P$, Me.Picture1
  159. Image1.Picture = Picture1.Picture
  160. Pic_Caption.Caption = P$
  161. Recnum.Caption = "Record" + Str$(Vscroll1.Value) + " of" + Str$(Vscroll1.Max)
  162. End Sub
  163.  
  164.